package com.bwie.es.controller;

import com.bwie.common.domain.po.Goods;
import com.bwie.common.domain.vo.GoodsVo;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.es.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/es")
public class EsController {
    @Autowired
    private EsService esService;

    @PostMapping("/batchAdd")
    public Result batchAdd(@RequestBody List<Goods> goodss){
        esService.batchAdd(goodss);
        return Result.success();
    }

    @PostMapping("/search")
    public Result<PageResult<Goods>> search(@RequestBody GoodsVo goodsVo){
        Result<PageResult<Goods>> result= esService.search(goodsVo);
        return result;
    }

}
